home *** CD-ROM | disk | FTP | other *** search
/ Enter 2010 January / ENTER_2010_01.iso / Programy / Gry / Base_Invaders_ / BaseInvadersSetup1.3.exe / {app} / Scripts / Campaign6Startup.lua < prev    next >
Encoding:
Text File  |  2007-01-25  |  8.3 KB  |  292 lines

  1. -- Demonstrate the Fan/Poison combo
  2. function CorneredCinematic()
  3.  
  4.  
  5.     local CinemaInvader  = G.CreateAt( "Spiker", Vector3( 124, 0, 130 ) );
  6.     local CinemaInvader2 = G.CreateAt( "Basic", Vector3( 130, 0, 130 ) );
  7.     local CinemaInvader3 = G.CreateAt( "Basic", Vector3( 124, 0, 124 ) );
  8.     local CinemaInvader4 = G.CreateAt( "Miner", Vector3( 130, 0, 124 ) );
  9.     
  10.     CinemaInvader.TurnOffAI()
  11.     CinemaInvader2.TurnOffAI()
  12.     CinemaInvader3.TurnOffAI()
  13.     CinemaInvader4.TurnOffAI()
  14.     
  15.     CinemaInvader.SetDirection(  Vector3( 1,0,-1) )
  16.     CinemaInvader2.SetDirection( Vector3(-1,0,-1) )
  17.     CinemaInvader3.SetDirection( Vector3( 1,0, 1) )
  18.     CinemaInvader4.SetDirection( Vector3(-1,0, 1) )
  19.             
  20.     TrapPlace( "wall", Vector3(140,0,130), Vector3(0,0,-1))
  21.     TrapPlace( "wall", Vector3(140,0,126), Vector3(0,0,-1))
  22.     TrapPlace( "wall", Vector3(140,0,122), Vector3(0,0,-1))
  23.     TrapPlace( "wall", Vector3(140,0,134), Vector3(0,0,-1))
  24.     TrapPlace( "wall", Vector3(140,0,138), Vector3(0,0,-1))
  25.     TrapPlace( "wall", Vector3(140,0,118), Vector3(0,0,-1))
  26.     TrapPlace( "wall", Vector3(140,0,142), Vector3(0,0,-1))
  27.     TrapPlace( "wall", Vector3(136,0,118), Vector3(0,0,-1))
  28.     TrapPlace( "wall", Vector3(136,0,142), Vector3(0,0,-1))
  29.     TrapPlace( "wall", Vector3(132,0,118), Vector3(0,0,-1))
  30.     TrapPlace( "wall", Vector3(132,0,142), Vector3(0,0,-1))
  31.     TrapPlace( "wall", Vector3(132,0,118), Vector3(0,0,-1))
  32.     TrapPlace( "wall", Vector3(132,0,142), Vector3(0,0,-1))
  33.     TrapPlace( "wall", Vector3(128,0,118), Vector3(0,0,-1))
  34.     TrapPlace( "wall", Vector3(128,0,142), Vector3(0,0,-1))
  35.     
  36.     
  37.     -- Look at the traps:
  38.     TrapPlace( "poison", Vector3(170,0,134), Vector3(0,0,-1));
  39.  
  40.     TraitorTalk( "Hey! I've been playing with the new poison trap." );
  41.     Camera.CinemaMove( Vector3(170,15,170), Vector3(170,0,134), 4 );
  42.     GameWait(4)
  43.  
  44.     TraitorTalk( "It creates poison mist clouds that makes invaders sick." );
  45.     GameWait(4)
  46.  
  47.     TraitorTalk( "Oh look a group of invaders!" );
  48.     Camera.CinemaMove( Vector3(170,35,170), Vector3(120,0,120), 0.5 );
  49.     GameWait(2)
  50.         
  51.     G.SayPhraseScript( "We need\n more troops!" , CinemaInvader );
  52.     GameWait(1)
  53.  
  54. --    G.EndCurrentPhrase( CinemaInvader )
  55.     G.SayPhraseScript( "Quit Stalling!" , CinemaInvader2 );
  56.     GameWait(1)
  57.     
  58.     TraitorTalk( "Watch this:" );
  59.     GameWait(1)
  60.     
  61.     TrapPlace( "fan", Vector3(178,0,130), Vector3(-1,0,0));
  62.     TrapPlace( "fan", Vector3(178,0,126), Vector3(-1,0,0));
  63.     Camera.CinemaMove( Vector3(170,35,170), Vector3(174,0,130), 0.5 );
  64.     GameWait(0.5)
  65.  
  66.     G.CreateAt( "MobilePoisonMist", Vector3( 174, 0, 130 ) );
  67.     G.CreateAt( "MobilePoisonMist", Vector3( 174, 0, 126 ) );
  68. --    Camera.CinemaLookAt( CinemaPoison );
  69.     Camera.CinemaMove( Vector3(170,35,170), Vector3(120,0,120), 3 );
  70.  
  71.     GameWait(3)
  72.     G.SayPhraseScript( "I feel sick!" , CinemaInvader3 );
  73.     GameWait(1)
  74.     G.SayPhraseScript( "My tummy hurts!" , CinemaInvader2 );
  75.     GameWait(1)
  76.     G.SayPhraseScript( "I hate this!" , CinemaInvader4 );
  77.     GameWait(3)
  78.  
  79.     TraitorTalk( "The Fans blow the Poison Mist, and you can even grab it!" );
  80.     GameWait(7)
  81.  
  82.     G.KillAllInvaders();
  83.     
  84. --    CinemaInvader.TurnOnAI()
  85. --    CinemaInvader2.TurnOnAI()
  86. --    CinemaInvader3.TurnOnAI()
  87. --    CinemaInvader4.TurnOnAI()
  88.     
  89. end
  90.  
  91. --Common Level Start Code
  92. function LevelStartup()
  93.  
  94.     G.Create( "MenuData/HudCog.xml" );
  95.     G.Create( "Data/GameCamera.xml" );
  96.     G.Create( "Data/CursorCog.xml" );
  97.  
  98.     MainLevel = G.Create( "Data/Levels/Campaign6.xml" );
  99.     MainLevel.CreateLevel();
  100.  
  101.     G.SetInvSpeed( 20 );
  102.     HUD.EnterLevel();
  103.     G.SetGameState( InLevel );
  104.     G.SetPoints(0)
  105.     
  106.     G.SetLightTime( 4 );
  107.     G.PostP( "None" );
  108.     --TraitorTalk(" ");
  109.  
  110.     -- gameStartTime = 10000000;
  111.  
  112.     HUD.Message( "VictoryCondition" , "SetText", "Control the Invasion while Cornered!"  );
  113.     HUD.Message( "LossCondition" , "SetText", "If the Tower falls you lose." );
  114.         
  115.     TraitorCanBeHidden = true
  116. end
  117.  
  118. LevelStartup()
  119.  
  120. function LevelIntro()
  121.     
  122.     local tempPos = Tower.GetPosition()
  123.     Camera.LookAtPosition( tempPos )
  124.  
  125.     gameStartTime = GameTime;
  126.  
  127.     ColorTextPopup( "Level 6: Poison Fields", Color(1,1,1,1) )
  128.  
  129.     G.DisableTrapAll()
  130.         
  131.     G.EnableTrap("wall");
  132.     G.EnableTrap("bomb");
  133.     
  134.     G.EnableTrap("axe");
  135.     G.EnableTrap("hammer");
  136.     --G.EnableTrap("spring");
  137.     G.EnableTrap("fan");
  138.     --G.EnableTrap("poison");
  139.     --G.EnableTrap("laser");
  140.  
  141.     DisableTraitor()
  142.     GameWait(1.5)
  143.     
  144.     
  145.     StartCinematic()
  146.         CorneredCinematic()
  147.     EndCinematic()
  148.         
  149. end
  150.  
  151. SpawnPoints = {}
  152.  
  153. function LevelSequence()
  154.     
  155.     -- 1st Have a tower and some walls and let the Basic guys attack.
  156.     Traitor.SetGuiPosition( "TraitorWindow"  , Vector3(0.6, -0.5, 1) );
  157.     
  158.     -- Set the spawn points
  159.     
  160.     SpawnPoints.NumPoints = 10
  161.     SpawnPoints[1] = Vector3(240, 0, 150)        -- zone 2
  162.     SpawnPoints[2] = Vector3(225, 0, 130)
  163.     SpawnPoints[3] = Vector3(250, 0, 121)
  164.     SpawnPoints[4] = Vector3(320, 0, 153)
  165.     SpawnPoints[5] = Vector3(260, 0, 110)
  166.     SpawnPoints[6] = Vector3(280, 0, 194)
  167.     
  168.     SpawnPoints[7] = Vector3(224, 0, 24)        -- zone 1    
  169.     SpawnPoints[8] = Vector3(231, 0, 31)
  170.     SpawnPoints[9] = Vector3(204, 0, 54)
  171.     SpawnPoints[10] = Vector3(193, 0, 49)
  172.     
  173.     SpawnPoints[7] = Vector3(324, 0, 184)        -- zone 3
  174.     SpawnPoints[8] = Vector3(331, 0, 181)
  175.     SpawnPoints[9] = Vector3(354, 0, 174)
  176.     SpawnPoints[10] = Vector3(349, 0, 199)
  177.     
  178.     
  179.     -- Start Spawning the guys
  180.     BasicWave = createSpawnStruct()
  181.     
  182.     BasicWave.Prob.Basic    = 2.0;
  183.     BasicWave.Prob.Miner    = 1.0;
  184.     BasicWave.Prob.Driller    = 1.0;
  185.     BasicWave.Prob.Spiker    = 1.0;
  186.     
  187.     BasicWave.SpawnSpeed    = 2.0;
  188.     BasicWave.MaxSpawn        = 15;
  189.     BasicWave.TotalSpawn    = 21;
  190.     BasicWave.GroupPercent    = 0.15;
  191.     BasicWave.GroupSize        = 1;
  192.     BasicWave.WhereToSpawn    = HardCodedSpawnPoints
  193.         
  194.         
  195.     GameWait(4)
  196.     --TraitorTalk("This terrain is unbearable!")
  197.     --GameWait(6)
  198.     --TraitorTalk("Do you see the rocky ground on top of all those hills?")
  199.     --GameWait(4)
  200.     --TraitorTalk("That type of terrain is unbuildable.  You can only build traps on grass and dirt.")
  201.     --GameWait(6)
  202.     --TraitorTalk("The only suitable spot is this cozy little nook nestled up against the hills.")
  203.     --GameWait(6)
  204.     --TraitorTalk("Unfortunately that means we're trapped.")
  205.     --GameWait(3)
  206.     --TraitorTalk("But not to worry, I have some things that will help.")
  207.     --GameWait(3)
  208.  
  209.     
  210.     TraitorTalk("Oh, I almost forgot. Here are the blueprints...")
  211.     GameWait(3)
  212.     
  213.     TrapTextPopup("Poison Mist")    
  214.     G.EnableTrap("poison");
  215.     GameWait(3)    
  216.     
  217. --    TraitorTalk("This will generate poison clouds that roam around and kill invaders over time.")
  218. --    GameWait(6)
  219.     --TraitorTalk("If they're placed near fans, the poison clouds will be blown around.")
  220.     --GameWait(7)
  221. --    TraitorTalk("You can even pick up the clouds with your hand!")
  222. --    GameWait(5)
  223.     
  224.     G.EarnPoints( 300 )    
  225.     
  226.     TraitorTalk("These should allow us to survive long enough.")
  227.     GameWait(7)
  228.     TraitorTalk("Why don't you place down some additional fortifications before the Invaders get here?");
  229.     GameWaitOrMoney(30)
  230.     
  231.     TraitorTalk("Whoa, here they come!");
  232.     GameWait(3)
  233.     AddWave( "BasicAttack", BasicWave )
  234.     G.SetMaxKills(25);
  235.     GameWait(3)
  236.     
  237.     InvadersKilledWait(25)
  238. --    TraitorTalk("All these Poison Traps give me an idea!")
  239. --    TraitorTalk("If you can hold out, I think I can create a virus to take out ALL the invaders.")
  240. --    TraitorTalk("It worked! But I don't think it will last long.")
  241. --    TraitorTalk("The invaders a resilient bunch, I'm sure they'll develop a resistance!")
  242.     
  243.     TraitorTalk("Don't get too cozy, I see more of them coming!")
  244.     GameWait(4)
  245.     TraitorTalk("Beef up the base while you still can!!")    
  246.     GameWaitOrMoney(30)
  247.         
  248.     BasicWave.Prob.Kamikaze    = 1.0;
  249.     BasicWave.TotalSpawn = 50
  250.     G.SetMaxKills(75)
  251.     
  252.     TraitorTalk("Here they come!!")
  253.     GameWait(5)
  254.     
  255.     InvadersKilledWait(75)
  256.     
  257.     TraitorTalk("Ack! They're still coming!  Is there no end to this?")
  258.     GameWait(6)
  259.     TraitorTalk("I'm sure this is the last wave.    ...   If it's not, we're in trouble...")
  260.     GameWait(7)
  261.         
  262.     --BasicWave.MaxSpawn = 50
  263.     BasicWave.TotalSpawn = 75
  264.     G.SetMaxKills(150)
  265.     AddWave( "BasicAttack", BasicWave )    
  266.     
  267.     InvadersKilledWait(100)
  268.     BasicWave.MaxSpawn        = 50
  269.     BasicWave.SpawnSpeed    = 4.0;
  270.     BasicWave.Prob.Spiker    = 3.0;
  271.     InvadersKilledWait(150)
  272.     
  273.     StopWave( "BasicAttack" )
  274.     
  275.     TraitorTalk("Whew, it ended!  Looks like the base held.")
  276.     GameWait(7)
  277.  
  278.     G.SetGameState( Victory );
  279.     
  280.     TraitorTalk("We should relocate before more of them arrive.  Let's move out!")
  281.     GameWait(6)
  282.         
  283. --    G.SetGameState( Victory );
  284.     
  285. end
  286.  
  287.  
  288.     
  289. levelRoutine = coroutine.create(LevelIntro);
  290.  
  291. GMain["LevelUpdate"] = LevelUpdate;
  292.